package guda.house.dal.dao;

import guda.house.dal.dataobject.UnitDO;
import guda.grape.autogen.common.page.BaseQuery;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

public interface UnitDAO {


    Long insert(UnitDO unit);

    @Cacheable(value = "villageCache", key="#unitId + 'getUnitById'")
    UnitDO getUnitById(Long unitId);


    boolean delUnitById(Long unitId);

    List<UnitDO> getUnitByIds(List idsList);

    /**
     * 清空测试用例加入的autoincrement
     */
    void cleanAutoIncrement(Long unitId);

    List<UnitDO> selectForPage(BaseQuery baseQuery);

    int countForPage(BaseQuery baseQuery);

    @CacheEvict(value = "villageCache", key="#unit.unitId + 'getUnitById'")
    void updateByIdSelective(UnitDO unit);

}
